<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input type="text" placeholder="enter the name you search" ref="cur"/>&nbsp;
      <button @click="handler">Search</button>
    </div>
  </section>
</template>

<script>
export default {
  name: "",
  methods: {
     //按钮的回调
     handler(){
       let userName = this.$refs.cur.value;
       if(userName.trim()=='') return;
       //触发自定义事件
       this.$bus.$emit('userName',userName);
       //点击完毕，清空文本里面的文字
       this.$refs.cur.value = '';
     }
  },
};
</script>

<style scoped>
</style>
